import { BaseController, CoolController } from "@cool-midway/core";
import { ProductItemEntity } from "../../entity/item";
import { ProductInfoEntity } from "../../entity/info";

/**
 * 产品SKU/项（后台）
 */
@CoolController({
    api: ['add', 'delete', 'update', 'info', 'list', 'page'],
    entity: ProductItemEntity,
    pageQueryOp: {
        select: ['a.*', 'b.name as productName'],
        join: [
            { entity: ProductInfoEntity, alias: 'b', condition: 'a.productId = b.id', type: 'leftJoin' },
        ],
        fieldEq: ['a.productId'],
        keyWordLikeFields: ['b.name', 'a.name']
    }
})
export class AdminProductItemController extends BaseController {}


